#include "open.h"

/* Koder - archaeological description tool
 * (c) 2007, Milosz Piglas
 * Distribution under  BSD-like license
 * It is distributed with absolutely no warranties
 */

void translate(char *items_t[], struct record *records_t, int ilen, int rlen)
{
	int t, s,cc,wc,i;
	char *mem, code[10];
	char *tmptab[50];
	for (t=0;t<ilen;t++)
	{
		wc=0;
		i=0;
		printf("\n%s\n",items_t[t]);
		for (cc=0;cc<strlen(items_t[t]);cc++)
		{
			if (items_t[t][cc] != '.')
			{
				code[i] = items_t[t][cc];
				i++;
			}
			else
			{
				code[i]='.';
				i++;
				code[i] = '\0';
			//	printf("%s\n",kod);
				mem = malloc(i);
				strcpy(mem,code);
				tmptab[wc] = mem;
				i=0;
				wc++;
			}
		}
		for (cc=0;cc<wc;cc++)
		{
			for (s=0;s<rlen;s++)
			{
				if (strcmp(tmptab[cc],(records_t+s)->VAL)==0)
				{
					printf("%s : %s\n",tmptab[cc], (records_t+s)->NAME );
				}
			}
			free(tmptab[cc]);
		}
	}
}


